package com.lostVip.app.data.util;

import java.sql.Connection;
import java.sql.DriverManager;

import javax.sql.DataSource;


public class DbConnUtil {
/**
 * 从这里取数据
 * @return
 */
	public static Connection createConnSrc() {
		Connection conn = null ;
			try {
				String driverClassName="net.sourceforge.jtds.jdbc.Driver";
				String dbUrl =  "jdbc:jtds:sqlserver://192.168.0.235:1433;DatabaseName=his";
				String dbUser = "sa";
				String dbPwd =  "lhl_sql_password_18610049186";
				Class.forName(driverClassName).newInstance();
				conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd);
			} catch (Exception e) {
				e.printStackTrace();
				
			}
			return conn;
		}
	
	
/**
 * 存入的目标数据库
 * @return
 */
	public static Connection createConnDist() {
		Connection conn = null ;
			try {
				String driverClassName="com.mysql.jdbc.Driver";
				String dbUrl =  "jdbc:mysql://localhost:3306/his3?useUnicode=true&characterEncoding=UTF-8";
				String dbUser = "root";
				String dbPwd =  "hly123";
				Class.forName(driverClassName).newInstance();
				conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd);
			} catch (Exception e) {
				e.printStackTrace();
				
			}
			
			return conn;
		}


public static void close(Connection conn) {
	try {
		conn.close();
	} catch (Exception e) {
		e.printStackTrace();
		
	}
}
	
	}


